//app.js
import api from './utils/api.js'
App({
  onLaunch: function () {
    // 展示本地存储能力
    var accessToken = wx.getStorageSync('accessToken') || ''
    console.log(1,accessToken)
    if(accessToken) {
      api.login(accessToken)
      .then(res => {
        console.log(1,res)
      }).catch(err => {
        wx.setStorageSync('accessToken', '')
        wx.setStorageSync('userInfo', '')
      })
    }
  },
  globalData: {
    userInfo: null,
    accessToken: null
  }
})